package com.example.aslongastoday.db.helper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class MyDatabaseHelper extends SQLiteOpenHelper {
    private SQLiteDatabase database;

    private static String DATA_BASE_NAME = "test_data_base";

    private static String BACK_LOG_GROUP_TABLE = "back_log_group";


    private static final int VERSION = 1;


    public MyDatabaseHelper(@Nullable Context context ) {
        super(context, DATA_BASE_NAME, null, VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //创建待办组表
        db.execSQL("create table "+BACK_LOG_GROUP_TABLE+"(_id integer primary key autoincrement," +
                "group_name text,create_time text,back_log_list text)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("drop table if exists "+BACK_LOG_GROUP_TABLE);
        onCreate(db);
    }
}
